/**
 * 
 */
package org.dse.html.processor;

import java.util.Map;

/**
 * This class gives a simple implementation to the tag processor container. It
 * uses a Map as the data structure. The key is the tag name and the object
 * associated with it is a proper tag processor.
 * 
 * The object of this class will be a singleton in one system running. It is
 * configged in the application context.
 * 
 * @author zhangchen
 * 
 */
public class TagProcessorContainerImpl implements TagProcessorContainer {

	private Map<String, TagProcessor> processorMap;

	/**
	 * The constructor. Fill the map, the data is configged in the application
	 * context.
	 * 
	 * @param map
	 *            it is configged in the application context
	 */
	public TagProcessorContainerImpl(Map<String, TagProcessor> map) {
		processorMap = map;
	}

	/**
	 * Use the get method of map to get a tag processor.
	 * 
	 * @param tagName
	 *            the specific tag which the processor processes
	 * @return the proper tag processor
	 */
	public TagProcessor getTagProcessor(String tagName) {
		return processorMap.get(tagName);
	}

}
